const path = require('path');
const {
    CleanWebpackPlugin
} = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
    entry: path.join(__dirname, 'index.js'), // 入口文件得对
    output: {
        path: path.join(__dirname, 'dist')
    },
    mode: 'production',
    module: {
        rules: [{
                test: /\.js$/,
                use: 'babel-loader'
            },
        ]
    },
    plugins: [
        new CleanWebpackPlugin(),
        // webpack处理html插件
        new HtmlWebpackPlugin({
            filename: "output.html",
            template: path.join(__dirname, "index.html")
        }),
    ]
};